import requests
import execjs

d = {
    "payload": {
        "libraryId": 33,
        "sectionId": 208,
        "filterConfigIds": [
            271,
            269,
            270,
            1404,
            889,
            305,
            272,
            266,
            1825,
            267,
            268,
            1162
        ],
        "queryParam": {
            "start": 0,
            "limit": 20,
            "searchFieldIds": None,
            "is_oversea": [
                "1",
                "2",
                "3",
                "4"
            ],
            "query_field_ids": None
        }
    },
    "v": -20180620
}

res = requests.post('https://vip.xiniudata.com/api/vip/web/login/login_by_password', json={
    "payload": {
        "account": "15225989853",
        "password": "zdz123123"
    },
    "v": -20180620
})

with open('./parse/2.烯牛数据.js', 'r', encoding='utf-8') as f:
    js_str = f.read()
    js_code = execjs.compile(js_str, cwd='./parse')
r = js_code.call('get_json', d)

response = requests.post("https://vip.xiniudata.com/api/vip/library/v3/init", json=r,cookies=res.cookies)
f = response.json()['d']
print(f)
r = js_code.call('get_data',f)
print(r)
